<?php
$name = $_POST['address'];

$con = mysqli_connect('localhost','root','','cs2102');
	if(mysqli_connect_errno($con))
	{
		echo "error";
	}
	else
	{
		$query = "SELECT * FROM dish where address = \"$name\"";
		$index =0;
		$result =  mysqli_query($con, $query);
		
		$content = array();
		while($row = mysqli_fetch_array($result)){
			$content["dish" . $index] = $row;
			$index++;
		}
		
		echo json_encode($content);
	}
	
	mysqli_close($con);
?>
